﻿using ICSharpCode.NRefactory.CSharp.Refactoring;
using Xunit;

namespace Framework.Tests.Refactoring
{
    public class CodeActionTest : ContextActionTestBase
    {
        [Fact]
        public void Should_test_create_field_with_token()
        {
            Test<CreateFieldAction>(
@"
class Foo
{
	public Foo (int i, string hello)
	{
		throw new System.NotImplementedException ();
	}
}
class TestClass
{
	void TestMethod ()
	{
		$foo = new Foo (0, ""Hello"");
	}
}
", 
@"
class Foo
{
	public Foo (int i, string hello)
	{
		throw new System.NotImplementedException ();
	}
}
class TestClass
{
	Foo foo;
	void TestMethod ()
	{
		foo = new Foo (0, ""Hello"");
	}
}
");
        }
        
        [Fact]
        public void Should_test_create_class_with_token()
        {
            Test<CreateClassDeclarationAction>(
                @"
class TestClass
{
	void TestMethod ()
	{
		$new Foo (0, ""Hello"");
	}
}
", @"
class Foo
{
	public Foo (int i, string hello)
	{
		throw new System.NotImplementedException ();
	}
}
class TestClass
{
	void TestMethod ()
	{
		new Foo (0, ""Hello"");
	}
}
");
        }
    }
}
